<template>
  <div id="app">
    <router-view></router-view>
    <div class="back-home" v-if="$route.path.includes('asset') && $route.path!='/asset/assetHome'" @click="goHome">
      <img src="@/assets/images/home.png" alt="" />
    </div>
  </div>
</template>

<script>
import { mapActions } from "vuex";
export default {
  name: "app",
  watch: {
    $route(to, from) {
      console.log(12, to, from);
      if (
        to.path == "/login" &&
        from.path != "/" &&
        from.path != "" &&
        from.path != "/meetingRoute" &&
        from.path != "/messageRoute" &&
        from.path != "/leaveRoute"
      ) {
        let temp = {
          path: from.path,
          query: JSON.parse(JSON.stringify(from.query)),
        };
        this.setOriginRoute(temp);
      }
    },
  },
  methods: {
    ...mapActions("routes", ["setOriginRoute"]),
    goHome(){
      this.$router.push('/asset/assetHome')
    }
  },
};
</script>

<style lang="less">
@import "~vux/src/styles/reset.less";

body {
  background-color: #fbf9fe;
  line-height: normal;
  font-size: 14px;
}
.back-home {
  display: block;
  width: 46px;
  height: 46px;
  z-index: 100;
  position: fixed;
  right: 20px;
  bottom: 80px;
  line-height: 46px;
  background-color:rgba(0,0,0,0.08);
  border-radius: 23px;
  text-align: center;
  img {
    display: inline-block;
    margin-top: 7px;
  }
}
</style>
